<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">
		<link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">
         <link rel="stylesheet" href="../../css/iscroll.css" /> 
        <style>
          #select1_dummy{
            text-align:center;
        	border:none;
        	padding-left:10px;
        	color:#555;
        	font-size:17px;
          }
          #select1_dummy:disabled{
        	background:#fff;
          }
        </style>



		<style>
			.msg-info {
				position: relative;
			}
			.msg-info .um-badge {
				position: absolute;
				right: -10px;
				font-size: 12px;
			}
			.msg-header {
				width: 40px;
				height: 40px;
				line-height: 40px;
				background: blue;
				border-radius: 50%;
				text-align: center;
				color: white;
			}

		</style>

		<script src="../../js/summer.js" ></script>
		<script src="../../js/jquery.min.js" ></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js" ></script>
		<script type="text/javascript" src="../../js/knockout.js"></script>

		<script type="text/javascript" src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
        <script src="../../js/iscroll.js"></script>
	</head>
	<body class="f14">
		<div class="um-win" id="Constructionlist">
			<div class="um-header" >
				<h3>施工完成列表</h3>
				<a href="#" class="um-back back" >返回</a>
			</div>
			<div class="um-input-group" >
						<span class="ti-search"></span>
						<input id="keyWords" type="search" class="form-control" placeholder="请输入商家编号或者商家名称搜索" /> <!--   汉字屏蔽   onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"      -->
						<button class="btn btn-inline btn-sm" onclick="searchOrderList();">搜索</button>
                    </div>
			<div class="um-content">
			       
				<div class="um-listview-wrap" id="listview">
				    <!-- <div class="um-input-text  tc h40" width="100%" >
					<span style="width:30%;text-align: left;">查询条件:</span>
					<input type="text"   id='select1_dummy' />
                    	<select id='select1'>
                    		<option value="1">合同编号</option>
                    		<option value="2">商家名称</option>
                    	</select>
				    </div>-->
					<ul class="um-list um-no-active" data-bind="foreach: data">
						<li class="um-listview-row" >
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
							<div class="um-list-item-inner">
								<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">
									<div class="um-bgc-blue um-white pt5 pb5 ">
										︱商家编号:<span data-bind="text:sjbh1"></span>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											派工日期:<span data-bind="text:pgrq1"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											派工时间:<span data-bind="text:pgsj1"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											要求竣工日期:<span data-bind="text:yqjgrq1"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											<p>
												<span class="um-red f20" data-bind="attr: {id: sjbh1}" style="visibility: hidden">*</span>
												<span>加急类型:</span><span data-bind="text:jjlx1=='N'?'否':'是'"></span>
											</p>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											工程主管:<span data-bind="text:gczg1"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											点位号:<span data-bind="text:pointId"></span>
										</div>
									</div>
									<div class="w" data-bind="attr: {id: bodyid}">
										<div class="um-md-6 w_50 fl mt10 mb10">
											未通过类型:<span data-bind="text:notthrough_type" class="um-red"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											.
										</div>
									</div>
									<div class="w" data-bind="attr: {id: bodyid}" style="white-space:normal;">
										<div class="fl mt10 mb10 ml15">
											未通过原因:<span data-bind="text:not_passed" class="um-red"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											是否停用:<span data-bind="text:stopstatus=='Y'?'已停用':'启用中'" class="um-red"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											.
										</div>
									</div>
								</div>
							</div> </a>
						</li>
					</ul>
					<p style="text-align: center;margin-top: 10px;margin-bottom: 10px;" onclick="updateList(installListindex, 4);">查看更多</p>
				</div>

			</div>

			<div class="um-footer">

			</div>
		</div>
		<script>
			var updateList;
			var key;
			var installListindex = 1;
			var sreachKey = "";
			$(function() {
				var installList = [];
				var times = 1;
				var ViewModel = function() {
				};
				var viewModel = new ViewModel();
				var pageIndexNow = 0;
				//构造控件实例
				var listview = UM.listview("#listview");
				//当前第几页
				viewModel.data = ko.observableArray([]);
				ko.applyBindings(viewModel);
				//绑定叶号，是否第一次bool
				updateList = function(index, cout) {
					doPost(adressHead.ISjtzImpl, "getAzPgxxList", {
						dataParm : {
							empId : summer.getStorage("userinfo").empId,
							star : index,
							sjmc_hth : sreachKey,
							status : 9 + "," + 6,
							count : cout
						}
					}, function(data) {
						if (index == 1) {
							try {
								while (viewModel.data.shift()) {
								}
							} catch(e) {
							}
						};
						if (data.result == 1) {
							if (data.data.length != "") {
								//$(".hd1").css("display", "none");
								//hide
								for (var i = 0; i < data.data.length; i++) {
									console.log("aaaa" + data.data[i]);
									viewModel.data.push({
										'sjbh1' : data.data[i].businessId,
										'pgrq1' : data.data[i].dispatchDate.substr(0, 10),
										'pgsj1' : data.data[i].dispatchTime.substr(11, 18),
										'yqjgrq1' : data.data[i].requiredCompletionDate.substr(0, 10),
										'jjlx1' : data.data[i].expressType,
										'gczg1' : data.data[i].engineeringSupervisor,
										'bodyid' : data.data[i].bodyid,
										'pointId' : data.data[i].pointId,
										'notthrough_type' : data.data[i].notthrough_type,
										'not_passed' : data.data[i].not_passed,
										//'status' : data.data[i].status == "4" ? "设备签收" : "施工整改",
										'status' : data.data[i].status,
										'stopstatus':data.data[i].stopstatus
									});
								};
								for (var i = 0; i < data.data.length; i++) {
									if (data.data[i].expressType == "Y") {
										$("#" + data.data[i].sjbh1).css("visibility", "visible");
									}
									if (data.data[i].status == "4") {
										$("#" + data.data[i].bodyid).css("display", "none");
									}
								}
								installListindex += data.data.length;
							} else {
								if (times != 1) {
									UM.toast({
										title : '友情提示：',
										text : '没有更多单据',
										duration : 1000
									});
								};
								$(".hd1").css("display", "block");
								//hide
								times++;
							}
						} else {
							UM.toast({
								title : '友情提示：',
								text : data.msg,
								duration : 1000
							});
						}
						listview.refresh();
					}, function(err) {
						console.log(err);
					});
				};
				window.bind = function() {
					updateList(1, 4);
				};
				$(".hd1").click(function(e) {
					updateList(1, 4);
					e.stopPropagation();
				});
				//添加控件方法
				listview.on("pullDown", function(sender) {
					installListindex = 1;
					updateList(installListindex, 4);
					//viewModel.data.unshift(row);
					sender.refresh();
				});
				listview.on("pullUp", function(sender) {
					updateList(installListindex, 4);
					sender.refresh();
				});
				listview.on("itemClick", function(sender, args) {
					//if(viewModel.data()[args.rowIndex].not_passed){
					//	alerts("未通过原因:"+ viewModel.data()[args.rowIndex].not_passed);
					//}
					setTimeout(function() {
						summer.openWin({
							id : "detail",
							url : "html/inspected/Dispatch_detail.html",
							pageParam : {
								bodyid : viewModel.data()[args.rowIndex].bodyid,
								billcode : viewModel.data()[args.rowIndex].billcode,
								status : viewModel.data()[args.rowIndex].status
							}
						});
					}, 100);
					//alert(args.rowIndex);
					//这里可以处理行点击事件，参数sender即为当前列表实例对象，args对象有2个属性，即rowIndex(行索引)和$target(目标行的jquery对象)
					//alert("您点击了列表的第" + (args.rowIndex + 1) +　"行！");
				});

			});
			/**
			 *  Search OrderList 
			 */
			function searchOrderList(){
				installListindex = 1;
			    sreachKey = $("input[type='search']").val();
			    updateList(1, 4);
			}
			summerready = function() {
				updateList(1, 4);
			};
			function rebind() {
				window.bind();
			}
		</script>

        <script>
        	 $(function () {
        		// var curr = new Date().getFullYear();
        	   var opt = {
        			'date': {
        				preset: 'date'
        			},
        			'select': {
        			   preset: 'select'
        		   }
        		};
        		$('#select1').scroller('destroy').scroller(
        			$.extend(opt['select'], {
        				theme: "ios7",
        				mode: "scroller",
        				display: "bottom",
        				animate: ""
        			})
        		);
        	});
        </script>
	</body>
</html>
<script type="text/javascript" src="../../js/Myjs/Common.js"></script>